_helo = _this select 0;
_callsign = _this select 1;
_heloNewStation = true;

// forces the server side helo object to become client side.
	[_helo] joinSilent player;
	[_helo] joinSilent grpNull;
	[_helo] joinSilent _grp;
	_helo setBehaviour "SAFE";
	_helo setCombatMode "BLUE";

_mkrname = format ["%1station", _helo];
_mkrname2 = format ["%1station2", _helo];
_stgtar = format ["'%1' setMarkerPos _pos,'%2' setMarkerPos _pos,RUM_ASclick = true",_mkrname,_mkrname2];
openMap [true,true];
onMapSingleClick _stgtar;
titleText ["Select a new Station Point", "PLAIN DOWN"];
waitUntil {RUM_ASclick};
onMapSingleClick "";
titleFadeOut 0;
sleep 1;
openMap [false,false];
RUM_ASclick = false;


_pos = getmarkerpos _mkrname;
_pilot = driver _helo;
_grp = group _pilot;

["movestation",[player,_pilot,_callsign,_pos]] execVM (RUM_PATH+"AHel\radiodialogs.sqf");
 sleep 5;

_markerpos = getmarkerpos _mkrname;
_helo_marker_distance = _markerpos distance [getPos _helo select 0, getPos _helo select 1, 0];
_dist1 = round _helo_marker_distance;


	if ((_dist1) <= 1300) then{

		// debug
		// hint "Station Close Started - Server";
		// sleep 1.5;
		If (local _helo) then {

			_wpAH=_grp addWaypoint [_pos, 0];
			_wpAH setWaypointType "MOVE";
			_wpAH setWaypointSpeed "NORMAL";
			_wpAH setWaypointBehaviour "CARELESS";
			_wpAH setWaypointCombatMode "BLUE";
			_wpAH setWaypointCompletionRadius 0;
			_helo flyInheight 32;
			sleep 4.75;
			deleteWaypoint [_grp, 0];
			_wpAH=_grp addWaypoint [_pos, 0];
			_wpAH setWaypointType "MOVE";
			_wpAH setWaypointSpeed "LIMITED";
			_wpAH setWaypointBehaviour "CARELESS";
			_wpAH setWaypointCombatMode "BLUE";
			_wpAH setWaypointCompletionRadius 0;
			_helo flyInheight 45;
			sleep 5;
			deleteWaypoint [_grp, 0];

		}else{

			_mtype = "MoveClose";
			RUM_AHel_ServerMoveStation = [_grp,_pos,_mtype,_helo];
			publicVariable "RUM_AHel_ServerMoveStation";
		
		};
		
	}else{

		// debug
		// hint "Station Far Started - Server";
		// sleep 1.5;

		If (local _helo) then {

			_wpAH=_grp addWaypoint [_pos, 0];
			_wpAH setWaypointType "MOVE";
			_wpAH setWaypointSpeed "NORMAL";
			_wpAH setWaypointBehaviour "CARELESS";
			_wpAH setWaypointCombatMode "BLUE";
			_wpAH setWaypointCompletionRadius 0;
			_helo flyInheight 32;
			sleep 4.75;
			deleteWaypoint [_grp, 0];
			_wpAH=_grp addWaypoint [_pos, 0];
			_wpAH setWaypointType "MOVE";
			_wpAH setWaypointSpeed "NORMAL";
			_wpAH setWaypointBehaviour "CARELESS";
			_wpAH setWaypointCombatMode "BLUE";
			_wpAH setWaypointCompletionRadius 0;
			_helo flyInheight 70;
			sleep 5;
			deleteWaypoint [_grp, 0];

		}else{

			_mtype = "MoveFar";
			RUM_AHel_ServerMoveStation = [_grp,_pos,_mtype,_helo];
			publicVariable "RUM_AHel_ServerMoveStation";
		};

	};

	while {_heloNewStation} do {
		if ((_helo_marker_distance) <= 150) then{

			// _pilot sidechat "Station Reached";

			If (local _helo) then {

				_wpAH=_grp addWaypoint [_pos, 0];
				_wpAH setWaypointType "MOVE";
				_wpAH setWaypointSpeed "NORMAL";
				_wpAH setWaypointBehaviour "CARELESS";
				_wpAH setWaypointCombatMode "BLUE";
				_wpAH setWaypointCompletionRadius 0;
				_helo flyInheight RUM_AHEL_flyStationHeight;
				sleep 5;
				deleteWaypoint [_grp, 0];
				_heloNewStation = false;

			}else{

				_mtype = "MoveSettle";
				RUM_AHel_ServerMoveStation = [_grp,_pos,_mtype,_helo];
				publicVariable "RUM_AHel_ServerMoveStation";
				_heloNewStation = false;
			
			};
			
		}else{
			If (!alive _helo) then {
				player sidechat "Helo has crashed or has been shot down.";
				_heloNewStation = false;
				exit;	
			}else{
				_helo_marker_distance = round (_markerpos distance [getPos _helo select 0, getPos _helo select 1, 0]);
				_helo_height = round (getPos _helo select 2);
				// hintsilent format ["Distance to Location: %1\n\nCurrent Altitude: %2", round _helo_marker_distance, _helo_height];
				sleep .05;
			};
		};
	};

waituntil{((getPos _helo select 2) <= (RUM_AHEL_flyStationHeight + 5))};
_pilot sidechat format["This is %1, station position reached.", _callsign ];
sleep 4;

// debug
// _helo_height = getPos _helo select 2;
// _pilot sidechat format["Current Altitude is: %1", _helo_height];


if(true)exitwith{};
